package org.gr.hotel.controller;

import java.util.List;

import org.gr.hotel.entity.User;
import org.gr.hotel.service.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;


@org.springframework.stereotype.Controller
public class Controller {

	@Autowired
	private Service service;
	
	@RequestMapping("/")
	public ModelAndView welcome(){
		ModelAndView mav = new ModelAndView("index");
		System.out.println("111");
		List<User> user = service.listAllUser();
		System.out.println(user);
		mav.addObject("user", user);
		
		return mav;
		
	}
	
}
